package cn.epsilon3.constant;

/**
 * @author epsilon3
 * @version 1.0
 * @project epsilon3-module-core
 * @description 字段脱敏预设类型枚举
 * @date 2023/6/10 10:46:28
 */
public enum DesensitizationFieldEnum {

    NONE("none"),
    EMAIL("email"),
    PHONE("phone"),
    NAME("name"),
    ID_CARD18("card18"),
    ;
    private final String type;

    DesensitizationFieldEnum(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public static DesensitizationFieldEnum getType(String methodThpe) {
        String upperCase = methodThpe.toUpperCase();
        for (DesensitizationFieldEnum desensitizationFieldEnum : DesensitizationFieldEnum.values()) {
            if (desensitizationFieldEnum.type.equals(upperCase)) {
                return desensitizationFieldEnum;
            }
        }
        return null;
    }
}
